package com.lightjet.macross.base.feign.api.remoteclient;

import com.lightjet.macross.base.feign.api.config.JWTFeignConfig;
import com.lightjet.macross.base.feign.api.dto.awf.FlowDataDTO;
import com.lightjet.macross.base.feign.api.dto.awf.TaskInstDTO;
import com.lightjet.macross.common.dto.ResponseDTO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

@FeignClient(value = "base-awf",configuration = JWTFeignConfig.class)
public interface BaseAWFRemoteClient {

    @PostMapping("/api/run/start")
    public ResponseDTO<String> Start(@RequestBody FlowDataDTO startFormDTO);

    @PostMapping("/api/run/mynode")
    public ResponseDTO<List<HashMap<String,String>>> MyNode(
            @RequestParam(name = "pdkey") String pdkey
            ,@RequestParam(name = "nodename") String nodename
            ,@RequestParam(name = "userid",required = false) String userid
    );

    @GetMapping("/api/his/audit")
    public ResponseDTO<List<HashMap>> AuditHistory(
            @RequestParam(name = "piid",required =true) String piid);

    @GetMapping("/api/his/audit/task")
    public ResponseDTO<List<HashMap>> AuditHistoryByTaskId(
            @RequestParam(name = "id",required =true) String id);

    @GetMapping("/api/run/process/status")
    public ResponseDTO<Map<String, Set<String>>> ProcessStatus(
            @RequestParam(name="piid") String piid);

    @PostMapping("/api/run/process")
    public ResponseDTO<String> Process(
            @RequestBody FlowDataDTO formdata);

    @PostMapping("/api/run/taskform")
    public ResponseDTO<List<HashMap>> TaskForm(
            @RequestParam(name = "taskid") String taskid);

    @DeleteMapping("/api/his/process")
    public ResponseDTO<List<HashMap>> DeleteProcess(
            @RequestParam(name = "piid_cs") String piid_cs,
            @RequestParam(name = "reason", required = false) String reason);

    @GetMapping("/api/his/process")
    public ResponseDTO<List<TaskInstDTO>> ProcessHistory(
            @RequestParam(name = "piid", required =true) String piid);

    @PostMapping(value="/api/his/tasksmap")
    public ResponseDTO<Map<String,List<TaskInstDTO>>> GetMappedTaskHisByPIIDs(@RequestBody List<String> piids);
}

